package lesson15;


public class Person 
{
	String name;
	int age;
	String personalNumber;
	char sex;
	double weight;
	Person[] friends;
	double money;
	Car car;
	
	Person()
	{
		this.age = 0;
		this.weight = 4.0;
	}
	
	Person(String name, String personalNumber, char sex)
	{
		this();
		this.name = name;
		this.personalNumber = personalNumber;
		this.sex = sex;
		this.friends = new Person[3];
	}
	
	void printPerson()
	{
		System.out.println("Name: " + name);
		System.out.println("Age: " + age);
		System.out.println("Personal number: " + personalNumber);
		System.out.println("Sex: " + sex);
		System.out.println("Weight: " + weight);
		System.out.println("Friends: " + friends.length);
	}
	
	void buyCar(Car car)
	{
		if(this.money >= car.price)
		{
			this.car = car;
			this.car.printCar();
			car.changeOwner(this);
		}
	}
	
	double sellCarForScrap()
	{
		double metalPrice = 200;
		return this.car.calculateCarPriceForScrap(metalPrice);	
	}
}
